package org.example;

public class Tree {
    public class TreeNode{
        TreeNode parents;
        int data;
        TreeNode[] sons;
        public TreeNode(TreeNode parents,int data){
            this.parents=parents;
            this.data=data;
        }
    }

    public static void main(String[] args) {
        Tree l=new Tree();
        TreeNode root= l.new TreeNode(null,9);
        TreeNode s1=l.new TreeNode(root,1);
        TreeNode s2=l.new TreeNode(root,2);
        TreeNode s3=l.new TreeNode(root,3);
        TreeNode firstSons[]=new TreeNode[3];
        firstSons[0]=s1;
        firstSons[1]=s2;
        firstSons[2]=s3;
        System.out.println(root.parents);
        System.out.println(s1.parents.data);
        for (int i=0;i< firstSons.length;i++){
            System.out.println(firstSons[i].data);
        }
    }
}
